<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
		<link rel="stylesheet" href="$!rc.contextPath/common/common.css" />
		<link rel="stylesheet" href="$!rc.contextPath/css/withdraw.css">
		<title>提现</title>
	</head>
	<body>
	<div class="title">
		<a onClick="javascript:window.history.go(-1)"><</a>
		提现
	</div>
	<div class="con">
		<div class="input">
			<span>提现金额</span>
			<input class="input-con" type="number" placeholder="请输入要提现金额" id="money" />
		</div>
		<div class="light-gray annotation">
			可提现金额$!member.availableBalance元，最低提现金额10.00元，需收取<span id="rate">1%</span>手续费
		</div>
	</div>
	<form onsubmit="return false;">
		<label class="withdrawal-way" for="s1">
			<div>
				<img src="$!rc.contextPath/img/pay/weixin.png" alt="" />
				<div>
					<p class="withdrawal-way-title">微信</p>
					<p class="withdrawal-way-intro gray">申请成功以后将成功打入你的账户</p>
				</div>
			</div>
			<input type="radio" class="radio" name="way" checked="checked" id="s1" />
		</label>
		<!-- <label class="withdrawal-way" for="s2">
			<div>
				<img src="$!rc.contextPath/img/pay/yinhangka_huang.png" alt="" />
				<div>
					<p class="withdrawal-way-title">银行</p>
					<p class="withdrawal-way-intro gray">申请成功以后将成功打入你的账户</p>
				</div>
			</div>
			<input type="radio" class="radio" name="way" id="s2" />
		</label> -->
		<div>
			<div class="card-id" style="display: block;">
				<div class="input">
					<span>微信账号：</span>
					<input class="input-con" type="text" placeholder="请输入微信账号" id="weixinAccount" maxlength="40" />
				</div>
				<!-- <div class="input">
					<span>微信密码：</span>
					<input class="input-con" type="password" placeholder="请输入要提现金额" />
				</div> -->
			</div>
			<div class="card-id">
				<div class="bind-card">
					<span>绑定银行卡</span>
					<img src="$!rc.contextPath/img/icon/jiantou.png" alt="" />
				</div>
				<!-- <div class="binded-card-list">
					<p class="binded-card-title">已绑定银行卡</p>
					<div class="card-list-show">
						<label class="withdrawal-way" for="s4">
							<div>
								<img src="$!rc.contextPath/img/pay/weixin.png" alt="" />
								<div>
									<p class="withdrawal-way-title">建设银行</p>
									<p class="withdrawal-way-intro gray">尾号1122</p>
								</div>
							</div>
							<input type="radio" class="radio" name="card" id="s4" />
						</label>
						<label class="withdrawal-way" for="s5">
							<div>
								<img src="$!rc.contextPath/img/pay/weixin.png" alt="" />
								<div>
									<p class="withdrawal-way-title">工商银行</p>
									<p class="withdrawal-way-intro gray">尾号3344</p>
								</div>
							</div>
							<input type="radio" class="radio" name="card" id="s5" />
						</label>
					</div>
					<p class="more-card">更多银行卡</p>
					<div class="card-list-hide">
						<label class="withdrawal-way" for="s6">
							<div>
								<img src="$!rc.contextPath/img/pay/weixin.png" alt="" />
								<div>
									<p class="withdrawal-way-title">建设银行</p>
									<p class="withdrawal-way-intro gray">尾号1122</p>
								</div>
							</div>
							<input type="radio" class="radio" name="card" id="s6" />
						</label>
						<label class="withdrawal-way" for="s7">
							<div>
								<img src="$!rc.contextPath/img/pay/weixin.png" alt="" />
								<div>
									<p class="withdrawal-way-title">工商银行</p>
									<p class="withdrawal-way-intro gray">尾号3344</p>
								</div>
							</div>
							<input type="radio" class="radio" name="card" id="s7" />
						</label>
					</div>
				</div> -->
			</div>
		</div>
		<div class="foot">
			<div class="platform">
				<div class="expense">
					<label for="s10">
						<input type="checkbox" id="s10" class="checkbox"/>
			          	<p>我已同意<a href="#">《参境39度提现协议》</a></p>
					</label>		
				</div>
			</div>
			<input type="button" id="txBtn" class="sub-button disabled" value="提现" onclick="f_apply()"/>
		</div>
		
	</form>
	</body>
	<script src="$!rc.contextPath/common/jquery-1.8.3.min.js"></script>
	<script type="text/javascript">
		//提现方式 1：支付宝 2：微信 3：银行卡
		var type = 2;
		var txRate = '$!txRate';
		var availableBalance = '$!member.availableBalance';
		
		$(function(){
			$("#rate").html(txRate*100 + "%");
		})
		
		function f_apply(){
			if($("#txBtn").attr("class").indexOf("disabled") == -1){
				var money = $("#money").val();
				if(money == null || money == '' || money < 10){
					alert("请输入正确的提现金额！");
					return false;
				}
				
				var weixinAccount = $("#weixinAccount").val();
				if(weixinAccount == null || weixinAccount == ''){
					alert("请输入您真实的微信账号！");
					return false;
				}
				
				if(money > availableBalance){
					alert("提现金额不能大于账户余额！");
					return false;
				}
				
				$.ajax({
	                type: 'POST',
	                url: '$!rc.contextPath/order/withdrawals',
	                data : {
	                	type : 2,
	                	money : money,
	                	weixinAccount : weixinAccount
	                },
	                dataType: 'json',
	                success: function(data){
	                    if(data.code == '0'){
	                    	console.log(data.data);
	                    	alert("提现申请成功！");
	                    	self.location=document.referrer;
	                    }else{
	                    	alert(data.text);
	                    }
	                }
	            });
				
			}else
				return false;
			
		}
		
	</script>
	<script src="$!rc.contextPath/js/withdraw.js"></script>
</html>
